Methods and apparatus for simultaneous automatic gain, phase and DC offset correction in communication receivers

ABSTRACT

Described herein is a method of automatic gain control and simultaneous digital correction of three types of variations in I/Q receivers: gain imbalance, phase imbalance, and DC offset. Three adaptation loops can operate simultaneously and use the output of an analog to digital converter (ADC) as their input, with the output driving digitally controllable analog components. With appropriate knowledge of signal statistics, the algorithm automatically optimally fills the ADC&#39;s full input signal range, providing an automatic gain control function and thus maximizing the signal-to-quantization-noise ratio. In so doing, it corrects gain imbalances between I and Q paths, while additional circuitry corrects DC offsets and phase imbalances.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to the field of communication receivers.

2. Prior Art

In a co-pending application for patent entitled “Adaptation Algorithm Based on Signal Statistics for Automatic Gain Control”, filed on Aug. 29, 2001 as application Ser. No. 09/942,298 by Mehdi Tavassoli Kilani et al. and assigned to the assignee of the present invention, a method for accomplishing automatic gain control digitally by using knowledge of signal statistics is described, wherein the adaptation process obtains the statistical characteristics of the received signal to estimate the input signal power level. The estimated input signal power level is used to adjust the gain of a variable gain amplifier for the automatic gain control.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 a is a diagram illustrating the use of a digital gain control in receivers having I and Q channels.

FIG. 1 b is a diagram illustrating the use of a digital gain control in receivers having I and Q channels in accordance with the present invention.

FIG. 1 c is a graph illustrating a typical Gaussian characteristic of gain mismatch in accordance with the prior art.

FIG. 1 d is a graph illustrating the uniformly distributed statistical parameter characteristic of the gain mismatch in accordance with the present invention, the limits of the distribution being no greater than the minimum step size of the VGA used.

FIG. 2 is a block diagram illustrating DC offset correction in each channel in accordance with the present invention.

FIG. 3 is a block diagram illustrating an I/Q phase imbalance correction circuit of a preferred embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

An exemplary receiver in which the preferred embodiments of the present invention may be used may have a low noise amplifier coupled to an antenna, a mixer and filter followed by a variable gain amplifier (VGA) and then an analog to digital converter (ADC). Alternatively, the “mixer” may be two mixers providing I and Q channel outputs, each mixer being followed by a filter and VGA. It is assumed for purposes of this disclosure that each VGA is digitally controlled, though that is not a limitation of the invention. In certain preferred embodiments, the ADC is a 2 bit converter having possible outputs of 00, 01, 10 and 11, though this is not a limitation of the invention. In the description of such an embodiment to follow, the minimum and maximum outputs shall be referred to as the extreme outputs. However as shall subsequently be seen, the present invention is not limited to use with such converters, and may be used with N bit converters where N is any value of two or more.

Gain Control

Gain control is required in modern wireless receivers due to the large variations in signal amplitude caused by unpredictable over-the-air channels. Additional gain variation is caused by intra-receiver component variations, causing a decrease in sensitivity unless corrected.

In a preferred embodiment, the gain control loop for a given channel operates by counting the number of extreme codes at the output of the ADC in a given time period. At the end of this time period, the number of extreme codes is compared (COMP) to a predefined reference level or count (Gain Ref), obtained a-priori by studying the expected signal statistics. If the number of counts exceeds the reference level, the output gain code is decreased to decrease the gain of the VGA. In the preferred embodiment, the gain code is decreased by some number proportional to the excess number of counts. If the count falls short, the gain code is increased, again by an appropriately scaled version of the count-to-reference difference.

Knowing a-priori the statistics of the input signal, the necessary accumulation time and gain control step size can be determined to ensure a given level of gain error. The technique works even when the source signal is dominated by channel noise, since these statistics are also knowable.

By judiciously choosing the above-mentioned scaling factors, and adding hysteresis in the loop, it is also possible to provide immunity to blocking and slow fading conditions common in receivers. In this manner, the gain control loop provides the input of the ADC with a constant-power signal that optimally fills the converter, even under adverse communication conditions.

Inter-Channel Gain Imbalance Correction

In receivers with both I and Q channel outputs, the gain control scheme described above can also be used to correct gain imbalances arising from component mismatches between the I and Q paths. One known method of gain control in I & Q receivers shown in FIG. 1 a provides the same gain voltage or code to both the I and Q sections, relying on analog circuit matching to ensure a match in I and Q channel gain. Alternatively if the above gain control technique is used independently in both channels as shown in FIG. 1 b, its self-correcting nature will in fact correct die-to-die analog circuit variations. Instead of the gain mismatch displaying a typical Gaussian characteristic of the prior art shown in FIG. 1 c, the mismatch will be a uniformly distributed statistical parameter shown in FIG. 1 d, with the limits of the distribution being no greater than the minimum step size of the VGA used. For typical 6σ process limits, this leads to a significant improvement in gain mismatch.

Due to the randomness of the input signal, the I and Q channels will exhibit the same power over an appropriate accumulation time. Each channel's gain control loop will converge to the same value, and thus the long-term gain error will always be smaller than the minimum gain step size.

DC Offset Correction

In practical receivers, the VGA and ADC circuits exhibit non-zero DC offsets due to parameter mismatches. The large baseband gains typically present in the receiver cause these DC offsets to reduce maximum signal handling capability, hence a DC offset correction scheme is necessary.

The DC offset correction loop of the present invention operates by again counting the number of extreme codes at the output of the ADC. In a preferred embodiment, the registers used in the gain control loop are reused for this purpose. As shown in FIG. 2, the difference between the upper extreme code count and the lower extreme code count over a predefined period of time is, assuming a zero-mean input signal, proportional to the DC offset created by the analog VGA. Thus if the difference is positive, the DC offset correction must bring the DC offset down. If the difference is negative, the DC offset correction must bring the DC offset up. This is done in the compensation circuit Comp. Two such loops are used in a receiver having I and Q channels. The two loops may operate simultaneously, or alternatively one after the other.

When considering small perturbations around the converged value, the DC offset correction is independent of gain control. This is because the two operations which provide the error signal in the two loops (a sum in the case of the gain control loop, a subtraction in the case of the DC control loop) are orthogonal to each other, hence cannot affect each other. In the case of large perturbations of the converged state, the operation of the two loops can be made independent by separating their time constants.

As in the previous two cases, the accumulation time can easily be increased or decreased to capture the true statistics of the input. In the preferred embodiment, this can be done by modifying the counter length, but the invention is not limited to this method.

Phase Imbalance Correction

A phase imbalance correction circuit of a preferred embodiment of the present invention is illustrated in FIG. 3. The phase imbalance correction operates by multiplying the received bits from each of the I and Q downconverter outputs. If there is no phase imbalance, and the signals are uncorrelated, the time-averaged (integrated) product must be zero. If there is a phase imbalance, this will appear as a value proportional to the imbalance and the integration time. To illustrate this, assume two uncorrelated (zero-mean) baseband signals A(t) and B(t) upconverted to some frequency ω by a transmitter, and transmitted over a perfect channel:

F(t)=A(t)sin ωt+B(t)cos ωt   (1)

Assuming for the moment no gain or DC offsets, we assume an ε phase error in the quadrature of the LO of the downconversion mixer. Multiplying F(t) with this LO and separating into I and Q paths:

I(t)=(A(t)sin ωt+B(t)cos ωt)sin ωt   (2)

Q(t)=(A(t)sin ωt+B(t)cos ωt)cos(ωt+ε)   (3)

Expanding and filtering out components near 2ω, the mixer output appears as:

$\begin{matrix} {{I(t)} = {\frac{1}{2}{A(t)}}} & (4) \\ {{Q(t)} = {{\frac{1}{2}{A(t)}\sin \; \varepsilon} + {\frac{1}{2}{B(t)}\cos \; \varepsilon}}} & (5) \end{matrix}$

Taking the integral over some time T of the product, we write the error function E(∈):

$\begin{matrix} {{E(\varepsilon)} = {\int_{0}^{T}{\left\lbrack {{I(t)} \times {Q(t)}} \right\rbrack \ {t}}}} & (6) \\ {= {\int_{0}^{T}{\left( {\frac{1}{2}{A(t)}} \right)\left( {{\frac{1}{2}{A(t)}\sin \; \varepsilon} + {\frac{1}{2}{B(t)}\cos \; \varepsilon}} \right)\ {t}}}} & (7) \\ {= {\int_{0}^{T}{\left( {{\frac{1}{4}{A^{2}(t)}\sin \; \varepsilon} + {\frac{1}{4}{A(t)}{B(t)}\cos \; \varepsilon}} \right)\ {t}}}} & (8) \\ {= {{\frac{1}{4}{\int_{0}^{T}{{A^{2}(t)}\sin \; \varepsilon \ {t}}}} + {\frac{1}{4}{\int_{0}^{T}{{A(t)}{B(t)}\cos \; \varepsilon \ {t}}}}}} & (9) \end{matrix}$

The second term is simply the cross-correlation of the two bitstreams A(t) B(t), which must be zero since they are uncorrelated. The first integral is simply the power of A(t) integrated over T, a known quantity. Writing ∫₀ ^(T) A²(t)dt as P_(i) and using sin(∈)≈∈:

$\begin{matrix} {{E(\varepsilon)} = {\frac{1}{4}P_{i}T\; \varepsilon}} & (10) \end{matrix}$

As can be seen, the technique is insensitive to gain imbalances between I and Q channels though not, as will be shown, to DC offsets in each.

In the Presence of DC Offsets

Examining the behavior of the system with unknown DC offsets α in the I channel and β in the Q channel (Equations (4) and (5) with the offsets added):

$\begin{matrix} {{I(t)} = {{\frac{1}{2}{A(t)}} + \alpha}} & (11) \\ {{Q(t)} = {{\frac{1}{2}{A(t)}\sin \; \varepsilon} + {\frac{1}{2}{B(t)}\cos \; \varepsilon} + \beta}} & (12) \end{matrix}$

Multiplying the two:

$\begin{matrix} {{E_{1}(\varepsilon)} = {\int_{0}^{T}{\left\lbrack {{\frac{1}{4}{A^{2}(t)}\sin \; \varepsilon} + {\frac{1}{4}{A(t)}{B(t)}\ \cos \; \varepsilon} + {\frac{1}{2}\alpha \; {A(t)}\sin \; \varepsilon} + {\frac{1}{2}\alpha \; {B(t)}\cos \; \varepsilon} + {\frac{1}{2}\beta \; {A(t)}} + {\alpha\beta}} \right\rbrack {t}}}} & (13) \end{matrix}$

The second through fifth terms integrate to zero if A(t) and B(t) are zero-mean and uncorrelated, yielding:

$\begin{matrix} {{E_{1}(\varepsilon)} = {{\frac{1}{4}P_{i}T\; \varepsilon} + {{\alpha\beta}\; T}}} & (14) \end{matrix}$

This term in αβ cannot be distinguished from the true phase error. To overcome this, integrate the above expression for a half-cycle T (one half the total integration period). During the other half-cycle, integrate the product of the inversion of the Q channel at the VGA input with the inversion of the I channel at the ADC output. Thus note the −1 boxes in FIG. 3, the second inversion in the Q channel returning the signal to its initial polarity, which can be done as part of the downstream processing. Thus, in the second half-cycle:

$\begin{matrix} {{I(t)} = {{{- \frac{1}{2}}{A(t)}} - \alpha}} & (15) \\ {{Q(t)} = {{{- \frac{1}{2}}{A(t)}\sin \; \varepsilon} - {\frac{1}{2}{B(t)}\cos \; \varepsilon} + \beta}} & (16) \end{matrix}$

Multiplying the two:

$\begin{matrix} {{E_{2}(\varepsilon)} = {\int_{0}^{T}{\left\lbrack {{\frac{1}{4}{A^{2}(t)}\sin \; \varepsilon} + {\frac{1}{4}{A(t)}{B(t)}\ \cos \; \varepsilon} + {\frac{1}{2}\alpha \; {A(t)}\sin \; \varepsilon} + {\frac{1}{2}\alpha \; {B(t)}\cos \; \varepsilon} - {\frac{1}{2}\beta \; {A(t)}} - {\alpha\beta}} \right\rbrack {t}}}} & (17) \end{matrix}$

Again, the second through fifth terms integrate to zero, giving:

$\begin{matrix} {{E_{2}(\varepsilon)} = {{\frac{1}{4}P_{i}T\; \varepsilon} - {{\alpha\beta}\; T}}} & (18) \end{matrix}$

Averaging (or combining or adding) E₁(t) and E₂(t):

$\begin{matrix} {{E(\varepsilon)} = {\frac{1}{4}P_{i}T\; \varepsilon}} & (19) \end{matrix}$

Thus the phase error cancellation technique is, to a first order, insensitive to DC offsets.

Correlated I and Q Signals

The phase-correction system described above operates very well with uncorrelated I and Q signals, such as Gaussian noise. When correlation is present, a different technique can be used.

A pilot tone is used to train the receiver before receiving data and the present invention is active only during the pilot tone. A sinusoid of random phase will have orthogonal components in I and Q, so the relevant integral again reduces to zero.

PREFERRED EMBODIMENT OF THE INVENTION

The above-described set of control loops can elegantly be implemented in digital logic, taking as their input the output bits of the ADC, and providing as their output a set of digital words that control the analog blocks to close the loops.

The gain control loop is implemented as a pair of accumulators which count the number of extreme codes in a given time period. At the end of this time period, the sum of the two accumulators is subtracted from a reference bit word. If the difference exceeds some positive threshold, a scaled version of the difference is subtracted from the output gain word. If the difference is smaller than some negative threshold, again a scaled version of the difference is added to the output gain word. In this way, it is possible to control both the gain and hysteresis of the gain loop. A limiter is also used in order to avoid causing overflow and underflow of the gain word.

The DC offset loop takes the same accumulators as the gain control loop but subtracts them. If this number exceeds some positive hysteresis threshold, a scaled version of the difference is subtracted from the output DC offset correction word. Similarly, if the difference is lower than some negative threshold, a scaled version of the difference is added to the output word. This scheme again provides control of the DC loop gain and hysteresis.

The phase imbalance correction loop is implemented with a digital multiplier that multiplies the I channel and Q channel ADC outputs. This value is accumulated in a large register for a given time period. At the end of this time period, the value of the accumulator represents, the positive half-cycle. The input to the Q channel VGA is then inverted using switches, and the output of the I channel ADC is logically inverted. Alternatively, the input to the I channel VGA could be inverted using switches, and the output of the Q channel ADC could be logically inverted before the multiplication. In that regard, the signal that is inverted before the respective VGA should be reinverted at the output of the phase imbalance correction block, or in further signal processing circuitry not shown. Which ever is inverted, the same accumulation is performed for the same time period. At the end of this second period, the value of the accumulator is proportional to the phase imbalance. If this imbalance exceeds some threshold, a scaled version of the accumulator is used to adjust the I/Q balance in the LO or mixer.

Since a typical implementation is largely digital, there are significant savings in power, and the method has an easily programmable tradeoff between accuracy and speed. By eliminating the need for analog power detectors, phase detectors, and DC servo loops, the method also decreases the precision analog content of the receiver, thereby reducing complexity and increasing robustness against implementation inaccuracies. This leads to lower die area, improved yields, and a reduced off-chip component count.

Finally, the method can operate on received data directly. Thus, in most cases, there is no need for a training sequence or other calibration periods that prevent the receiver from being used to receive useful data.

As previously mentioned, the present invention is not limited to use with 2 bit converters, and may be used with N bit converters where N is any value of two or more. In implementations where N is three or more, a code may be considered extreme if it approaches either limit by some predetermined magnitude, such as by way of example, one half or three quarters of its extreme value. Also different predetermined magnitudes might be used for different compensation loops. Further, one may use the same accumulator values for the gain compensation (the sum of the values) as for DC offset compensation (the difference in the values). The time constants may be separated by controlling the amount the gain and DC offset are adjusted in a given correction period, as controlling the loop-gain of a correction loop controls its time constant. In a preferred embodiment, these two loops are intentionally given much different integration times so that they operate independently during startup or in the presence of a large signal disturbance. In that regard, note that the DC offset compensation loop is not sensitive to signal statistics or on orthogonality or signal independence between channels, so may continue to operate after the training time for signals that are not independent or perfectly orthogonal. Otherwise implementation and operation of the invention can remain as described. Whether N is 2 or is more than 2, the accumulators effectively operate as counters.

Thus while certain preferred embodiments of the present invention have been disclosed and described herein for purposes of illustration and not for purposes of limitation, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention. 

1. A method of DC offset correction in a communication receiver having I and Q channels, each channel having an amplifier having an output coupled to an analog to digital converter (ADC) providing digital outputs ranging from a lowermost digital value to an uppermost digital value, comprising: for each channel, accumulating for a first period of time, a first count of the number of outputs of the ADC that are equal to or greater than a second upper digital value and accumulating a second count of the number of digital outputs that are equal to or less than a second lower digital value, the magnitude of any difference between the second upper digital value and the uppermost digital value being the same as the magnitude of any difference between the second lower digital value and the lowermost digital value; if the first count is greater than the second count for a channel, decreasing the input offset for the respective channel; and, if the first count is less than the second count for a channel, increasing the input offset for the respective channel.
 2. The method of claim 1 wherein the DC offset is changed by an amount responsive to the difference between the first and second count, and the gain is changed by an amount responsive to the sum of the first and second counts.
 3. The method of claim 1 wherein the digital output is a two bit digital output, and the first and second upper digital values are equal to the uppermost digital value and the first and second lower digital values are equal to the lowermost digital value.
 4. A method of phase correction in a communication receiver having I and Q channels, each channel having an amplifier having an output coupled to an analog to digital converter (ADC) providing digital outputs ranging from a lowermost digital value to an uppermost digital value, comprising: accumulating for a first period of time, the product of the output of the ADC in the I channel and the output of the ADC in the Q channel; adjusting the phase between the I and Q channels responsive to the accumulated product of the output of the ADC in the I channel and the output of the ADC in the Q channel to reduce the phase error.
 5. The method of claim 4 further comprised of inverting the input to the VGA in a first of the I and Q channels and inverting the output of the ADC in a second of the I and Q channels, and accumulating for a second period of time equal to the first period of time, the product of the output of the ADC in the I channel and the output of the ADC in the Q channel, and adjusting the phase between the I and Q channels responsive to the sum of the products accumulated during the first and second time periods to reduce the phase error.
 6. The method of claim 5 wherein the phase is adjusted in an amount in proportion to the sum of the accumulated products.
 7. The method of claim 6 wherein the phase-is adjusted in an amount in proportion to the sum of the accumulated products if the accumulated products exceed a predetermined threshold.
 8. A method of simultaneous gain and DC offset correction in a communication receiver having I and Q channels, each channel having a variable gain amplifier (VGA) having an output coupled to an analog to digital converter (ADC) providing digital outputs ranging from a lowermost digital value to an uppermost digital value, comprising: for each channel, accumulating for a first period of time, a first count of the number of outputs of the ADC that are equal to or greater than a first upper digital value and accumulating a second count of the number of digital outputs that are equal to or less than a first lower digital value, the magnitude of any difference between the first upper digital value and the uppermost digital value being the same as the magnitude of any difference between the first lower digital value and the lowermost digital value; if the total of the first and second counts for a channel is less than a predetermined number, increasing the gain of the VGA in the respective channel; if the total of the first and second counts for one or more channels is more than a predetermined number, decreasing the gain of the VGA in the respective channel; for each channel, accumulating for a second period of time, a third count of the number of outputs of the ADC that are equal to or greater than a second upper digital value and accumulating a fourth count of the number of digital outputs that are equal to or less than a second lower digital value, the magnitude of any difference between the second upper digital value and the uppermost digital value being the same as the magnitude of any difference between the second lower digital value and the lowermost digital value; if the third count is greater than the fourth count for a channel, decreasing the input offset for the respective channel; and, if the third count is less than the fourth count for a channel, increasing the input offset for the respective channel.
 9. The method of claim 8 wherein the first and second periods of time are different periods of time.
 10. The method of claim 9 wherein the first and second periods of time are different duration periods of time.
 11. The method of claim 8 wherein the first and second periods of time are different duration periods of time.
 12. The method of claim 8 wherein the DC offset is changed by an amount responsive to the difference between the third and fourth count, and the gain is changed by an amount responsive to the sum of the first and second counts.
 13. The method of claim 8 wherein the second upper digital value is equal to the first upper digital value and the second lower digital value is equal to the first lower digital value.
 14. The method of claim 8 wherein the digital output is a two bit digital output, and the first and second upper digital values are equal to the uppermost digital value and the first and second lower digital values are equal to the lowermost digital value.
 15. A method of gain and phase correction in a communication receiver having I and Q channels, each channel having a variable gain amplifier (VGA) having an output coupled to an analog to digital converter (ADC) providing digital outputs ranging from a lowermost digital value to an uppermost digital value, comprising: for each channel, accumulating for a first period of time, a first count of the number of outputs of the ADC that are equal to or greater than a first upper digital value and accumulating a second count of the number of digital outputs that are equal to or less than a first lower digital value, the magnitude of any difference between the first upper digital value and the uppermost digital value being the same as the magnitude of any difference between the first lower digital value and the lowermost digital value; if the total of the first and second counts for a channel is less than a predetermined number, increasing the gain of the VGA in the respective channel; if the total of the first and second counts for one or more channels is more than a predetermined number, decreasing the gain of the VGA in the respective channel; accumulating for a second period of time, the product of the output of the ADC in the I channel and the output of the ADC in the Q channel; adjusting the phase between the I and Q channels responsive to the accumulated product of the output of the ADC in the I channel and the output of the ADC in the Q channel to reduce the phase error.
 16. The method of claim 15 further comprised of inverting the input to the VGA in a first of the I and Q channels and inverting the output of the ADC in a second of the I and Q channels, and accumulating for a third period of time equal to the second period of time, the product of the output of the ADC in the I channel and the output of the ADC in the Q channel, and adjusting the phase between the I and Q channels responsive to the sum of the products accumulated during the second and third time periods to reduce the phase error.
 17. The method of claim 16 wherein the phase is adjusted in an amount in proportion to the sum of the accumulated products.
 18. The method of claim 17 wherein the phase is adjusted in an amount in proportion to the sum of the accumulated products if the accumulated products exceed a predetermined threshold.
 19. A method of DC offset and phase correction in a communication receiver having I and Q channels, each channel having a variable gain amplifier (VGA) having an output coupled to an analog to digital converter (ADC) providing digital outputs ranging from a lowermost digital value to an uppermost digital value, comprising: for each channel, accumulating for a first period of time, a first count of the number of outputs of the ADC that are equal to or greater than a first upper digital value and accumulating a second count of the number of digital outputs that are equal to or less than a first lower digital value, the magnitude of any difference between the first upper digital value and the uppermost digital value being the same as the magnitude of any difference between the first lower digital value and the lowermost digital value; if the first count is greater than the second count for a channel, decreasing the input offset for the respective channel; and, if the first count is less than the second count for a channel, increasing the input offset for the respective channel; accumulating for one half of a second period of time, the product of the output of the ADC in the I channel and the output of the ADC in the Q channel, and for the other half of the second time period, accumulating the product of the inverse of the output of the ADC of one channel and the inverse of the VGA input of the other channel; adjusting the phase between the I and Q channels responsive to the combined accumulations during the two halves of the second time period to reduce the phase error.
 20. The method of claim 19 wherein the digital output is a two bit digital output, and the first and second upper digital values are equal to the uppermost digital value and the first and second lower digital values are equal to the lowermost digital value.
 21. A method of gain, DC offset and phase correction in a communication receiver having I and Q channels, each channel having a variable gain amplifier (VGA) having an output coupled to an analog to digital converter (ADC) providing digital outputs ranging from a lowermost digital value to an uppermost digital value, comprising: for each channel, accumulating for a first period of time, a first count of the number of outputs of the ADC that are equal to or greater than a first upper digital value and accumulating a second count of the number of digital outputs that are equal to or less than a first lower digital value, the magnitude of any difference between the first upper digital value and the uppermost digital value being the same as the magnitude of any difference between the first lower digital value and the lowermost digital value; if the total of the first and second counts for a channel is less than a predetermined number, increasing the gain of the VGA in the respective channel; if the total of the first and second counts for one or more channels is more than a predetermined number, decreasing the gain of the VGA in the respective channel; for each channel, accumulating for a second period of time, a third count of the number of outputs of the ADC that are equal to or greater than a second upper digital value and accumulating a fourth count of the number of digital outputs that are equal to or less than a second lower digital value, the magnitude of any difference between the second upper digital value and the uppermost digital value being the same as the magnitude of any difference between the second lower digital value and the lowermost digital value; if the third count is greater than the fourth count for a channel, decreasing the input offset for the respective channel; and, if the third count is less than the fourth count for a channel, increasing the input offset for the respective channel; accumulating for one half of a second period of time, the product of the output of the ADC in the I channel and the output of the ADC in the Q channel, and for the other half of the second time period, accumulating the product of the inverse of the output of the ADC of one channel and the inverse of the VGA input of the other channel; adjusting the phase between the I and Q channels responsive to the combined accumulations during the two halves of the second time period to reduce the phase error.
 22. The method of claim 21 wherein the phase is adjusted in an amount in proportion to the sum of the accumulated products.
 23. The method of claim 22 wherein the phase is adjusted in an amount in proportion to the sum of the accumulated products if the accumulated products exceed a predetermined threshold.
 24. The method of claim 21 wherein the digital output is a two bit digital output, and the first and second upper digital value are equal to the uppermost digital value and the first and second lower digital value are equal to the lowermost digital value. 